home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SuperHack
/
SuperHack CD.bin
/
Hack
/
UNIX
/
DISCRETE.ZIP
/
DISCRETE.DOC
Wrap
Text File
|
1996-05-19
|
35KB
|
772 lines
The THC Hack/Phreak Archives: DISCRETE.DOC (2088 lines)
Note: I did not write any of these textfiles. They are being posted from
the archive as a public service only - any copyrights belong to the
authors. See the footer for important information.
==========================================================================
///////////////////////////////////////////
// Baldrick's guide to discrete UNIX use //
// Complete with Internet babble //
///////////////////////////////////////////
First edition: Never before released in
any bloody form.
.. Volume 1: The story so far....
==============================================================================
DISCLAIMER: I didn't write this file. Someone else did and framed me using
my pseudo so I'm obivously not liable for any of it. He went
that way.
TEASER: If you really liked this file then just wait a bit and if I figure
out any new and funky interesting tips I'll put them out too in a
text phile series that would make Maury Pauvich turn green.
==============================================================================
//////////////
///Contents///
//////////////
.(if you wanna find it quick, search for the contents number x.x)
1.0.Introduction (aka mindless self-indulged ego statements and pseudo-
visionary babble about the realisation of Cyberspace)
2.0 UNIX from DOS in thirty minutes or your money back
2.1 Logging in and logging out
2.2 Basic file manipulation
2.3 The manic man command
2.4 Reaching Nirvanna through ed(1) (text manipulation)
2.5 Intra-system communication - who, finger, write, talk, etc.
2.6 Multitasking without L.S.D.
2.7 Security - file permissions and chmod
3.0.Playtime on your local system
3.1 aliasing commands
3.2 Shell scripts (incl. ~/.*)
3.3 Changing your default shell and the tcsh shell.
3.4 Causing mindless havoc through write and other childish tricks
3.5 The Importance of Being Earnest (hiding what you are doing)
3.6 cat /etc/passwd > ~/lab7.h
3.7 Security - A couple of cunning plans
4.0.Reach out and touch someone (playing with the Internet)
4.1 finger, talk, and mail to remote clients
4.2 USENet newsgroups
4.3 telnet and rlogin
4.4 FTP and FSP
4.5 Gopher
4.6 MUD, MUSH, MUCK, MUSE, IRC
5.0.Piracy and Internet
5.1 The Internet Pirate: Scourge of the Network
5.2 Getting Contacts
5.3 Information Trading
5.4 Paranoia (how to not get caught)
5.5 Aside: Faking Mail
5.6 Aside: Naughty Pictures
6.0.Onwards to Victory
. //////////////////////
. . // 1.0 Introduction //
//////////////////////
So I wanna be a guru... A couple years ago, the foolish computer science
faculty at my post-secondary institution were nice enough to give me my very
own spanking new UNIX account. After spending the first afternoon buggering
around typing the only command I thought I knew ("sh us", actually a VMS
command that had somehow sprung into my head), I gave up the cause of getting
any information for lost.
My lethargy soon lifted, however, and I set out on a quest to get some
information on UNIX. The computing services people graciously provided me
with two duplexed photocopy sheets of information, and I supplemented that
with Brian Kernaghan's "A Beginner's Guide to UNIX" and then I was on my way.
Now it seems that lots of people I know are just getting into the UNIX
/ Internet thing and want to know how to USE it. Not how to read their mail
and play MUD, but all sorts of things that go on slightly under the table...
"I don't know much, but here's something to get you started" I invariably
reply to these people and promptly wear myself out typing page after page of
"Oh, P.S. - you might also want to ..." statements. And so, I've set out to
create what you have before you - Baldrick's guide to discrete UNIX use.
This is an attempt at answering all the questions I had when I was learning
and couldn't find the answers. I was very lucky to know some people who
dropped me hints and put up with my whining - the best way to learn UNIX is
apprenticeship it seems (the guild system alive and well?).
To close off this lofty and drab introduction, I'd like to offer ceremonial
gold stars for cooperation and UNIX knowhow to Gollum, without whom I would
probably be hanging out in #esperanto. Thanks also to Puzzling Evidence, who
although by his own admission "UNIX dumb" managed to find out a hell of a lot
and write a damn good article about it before I was even a sparkle in the
great big Computing Services martini. Stingray also gets some honorable
mention for his general smarts in UNIX nastiness.
/////////////////////////////////////////////////////////
// 2.0 UNIX from DOS in ten minutes or your money back //
/////////////////////////////////////////////////////////
2.1 Logging in and Logging out
------------------------------
You begin here.
There are two obvious ways of getting onto a system to log in - one is by
using an ever-so-stylish terminal, and the other is by actually phoning in
from home using communications software. There are usually machine-specific
ways of doing each (wake-up commands for the terminals, and wierd tripped out
modem settings like 9600 7O1) which you will have to find out from whoever
gave (stole?) you an account.
When you do finally get connected to the UNIX system, you will see a header
resembling this:
SunOS UNIX (systemid)
login:
The login: prompt is the infamous hallmark of a UNIX system. You will have
a user id which can be up to 8 characters and which is typed entirely in
lower case. This is often your first initial followed by your last name (or
the first seven letters of it). Once you have entered a login id, regarldess
of whether it is right or wrong, you will see the prompt
Password:
and you must enter a password. This is case sensitive (as is everything in
UNIX) and not echoed as you type. Assuming you get everything right, you
should be rewarded with the login message; if you screw something up then
you'll end up seeing the rather unpleasent
Login incorrect
login:
and you'll get to try again. Most systems get tired of you after four or five
attempts and will drop the connection with a curt "too many attempts / bye".
Once you've gotten past the login part, the UNIX system will automatically
display any prominent bulletins from the administration (these are
stored in the file /etc/motd if you ever need to see them again), and then
proceeds to log you in according to the settings you have recorded in your
.cshrc and .login scripts (these are usually preset for you, but you may want
to play with them and customize things. More on this later - see section 3.2).
You may be asked to enter your terminal type (vt100 or vt220 are often the
standards) while this process takes place, and you may be notified of any new
news in the newsgroups you are subscribed to, along with any mail you have
waiting. If all goes well you will either end up in the shell - your command
prompt.
UNIX comes with two default shells: the bourne shell (prompt is a dollar
sign, '$') and the C Shell (prompt is a percent sign, '%'). On all the
systems I've used, the C shell has been the default. Often the prompt also
includes the name of the machine (but not the current directory, like a $p$g
in DOS). Most systems also have the "tcsh" shell, which is an advanced
version of the C-Shell with some nifty features. More on using that
later.
From here, you are free to explore with any of the topics mentioned
elsewhere. Keep in mind that when you want to quit, just type 'logout' to
logoff the system.
To change your password at any time, simply enter the command, "passwd" at the
prompt. UNIX will ask you to type your old password, and if you get it right
you will be able to enter a new one (you will also be asked to type it again
for verification).
2.2 Basic File Manipulation
---------------------------
Here I'll basically tell you the equivalents of your favourite DOS commands.
To get full (but alas totally incomprehensible) help on ANY UNIX command, type
man [command]
man stands for the UNIX online manual.
*Command: ls..In DOS:.dir
In UNIX, ls (a prophetic abbreviation for LiSt files) will list the files in
the current directory. Simply typing ls will give you a terse listing of
filenames only (a lot like a dir /w). By default, UNIX does not display any
file beginning with a period "." character (this is used so you don't have
to see administrative files every time you do an ls command.) Typing ls -a
will show ALL files, including these hidden files. Typing ls -l will display
a listing in a long format, more similar to a normal DOS dir command.
You can combine these options: ls -al will list all files, in long format.
A useful additive is ls -F; this will mark all direcotires with a
trailing slash (eg: dirname/ ) in an ls listing. this is a faster way
of identifying directories than using ls -l.
*Command: pwd In DOS: cd with no arguments
pwd stands for "print working directory". This is the best way to find out
where in the hell you are. It's quite easy to get lost on a mainframe system
when changing directories raplidly; pwd will tell you what directory you are
in by displaying the path from the root)
You start in your Home Directory - this is your personal space to put Stuff.
You can get info about your privelages by using the du and quota commands:
*Command: du..In DOS: No equivalent
du will simply tell you how much disk space the files in the current directory
are taking up. It's handy to let you know where all your home directory space
has gone.
*Command: quota..In DOS: No equivalent
Use the command:
quota -v
to get information on your space restrictions. you will usually be shown how
much space you were given, and your maximum limit (usually you are allowed to
go over by 100K or so, but you get nasty messages if you keep this much Stuff
in your directory. If you go over the limit, you will not be allowed to save
any more Stuff.
*Command: cd..In DOS: cd / chdir
cd is the basic method of changing directories. Like in DOS, a single period
'.' stands for the current directory (and can be used as a command argument)
and a double period '..' stands for the parent directory (one level up).
Unlike DOS, diretories in a path are seperated with FORWARD not backward
slashes. This will drive you absolutely nuts every time you shell to DOS
from your communication program and try to change directories. Furthermore,
in UNIX, you have one extra symbol you can stick in a path. The tilde
character (~) stands for your home directory - this is very useful in a huge
file structure such as you often find on mainframe systems.
Examples: cd ~/mystuff/textdir
. cd ../../incoming
*Command: cp..In DOS: copy
cp is equivalent to the DOS copy command. The only difference is that you
MUST use two arguments: cp f1 f2 ; you cannot just leave off the second one
and expect UNIX to default to the current directory. (to achieve this you
just use '.'). Thus, you cannot type 'cp News/rec.arts' and expect that
file to pop into your current directory - you'd have to type one of the
following:
.cp News/rec.arts .
.cp News/rec.arts rec.arts
.cp News/rec.arts newname
This command also brings us to the topic of the * wildcard character. UNIX
is quite a bit more versatile than DOS here - you can use a * parameter by
itself to indicate you want all files, or even take a *.txt for example,
which will even allow you to get files like this_has_a-longName.txt.
*Command: mv..In DOS: ren (well, sort of)
The mv command moves the first file argument to the second file argument.
You can use this to rename files, or to move them around. Just like the
cp command, you MUST use two arguments.
*Command: rm..In DOS: del or erase
The rm command will ReMove a file. There is no warning before it does it and
it's pretty much irreversable (Central Point Undelete can't help you now that
you've left Kansas). Even more annoying, you can type rm * and kill EVERYTHING
very quickly without an 'Are you sure' prompt. It is sometimes a good idea
to call rm with the -i switch so that it confirms each deletion seperately.
It is actually an even better idea to alias it to always use the -i switch -
see section 3.1. You can remove a DIRECTORY and all its contents (no
verification) by using rm -r [dirname].
*Command: mkdir.In DOS: md or mkdir
mkdir functions the same as in DOS - it creates a subdirectory in the current
directory.
*Command: rmdir..In DOS: rd or rmdir
rmdir will remove an EMPTY directory, the same as the equivalent DOS
command. Similarly, if there are still files in the directory rmdir will
display an error message. Use rm with the -r switch to remove a directory
and contents.
*Command: cat..In DOS: type
the cat command will display the contents of a file to the screen with no
formatting and no pauses - it functions exactly the same as the DOS type
command. Similarly in DOS and UNIX, if you try to display the contents of a
binary file you may get unpredicatble results and you probably won't get to
see the whole file contents. Cat is often used in conjunction with the UNIX
pipe and redirection commnands. These commands exist in DOS where they are
seldom used; in UNIX they're extremely useful and you will want to use them a
lot.
*Command: >, <, | In DOS: <,>,| - file redirection and pipes
You can send the output of a command to a file by using the redirect output
(greater-than sign, '>') command. For example, you can crudely copy a file
by using this command:
cat [file1] > [file2].
(This is useful when you have read permissions to a file but not exec
permissions and you can't copy it with the cp command but can display it
with cat). Similarly, you can redirect the input to make it a file rather
than the 'standard input'. This is done with the input redirection (less
than sign,'<') command. For example, you could issue the command:
ed /etc/passwd <rootscript >newpsswd
Which would run ed on the /etc/passwd file, issuing the commands as you have
typed them into the file rootscript, and then output any messages to newpsswd.
Using the symbol '>>' will append to the destination file rather than
overwriting it as you would with '>'. So you can:
crack <passwd >>valids
You get the idea...
The pipe command "|" allows you connect the output from one program to the
input of another. For example:
ls -al | stripblanks >>outfile
would run the executable 'stripblanks' with its input as the output of the
'ls -al' command, and the output from stripblanks is appended to the file
'outfile'.
*Command: grep..In DOS: No equivalent
grep is a useful command that lets you pick needles out of haystacks. The
syntax is:
grep [<">pattern<">] [filename]
You type a pattern to search for (use quotation marks around it if it
contains any spaces) and a filename and grep will dispaly all the LINES in
filename that contain the pattern. For example,
grep root /etc/utmp
Will find and display all lines with the pattern "root" in the file /etc/utmp.
Using grep on a binary file can have unpredictable results. grep is
especially useful for files where one record takes up one line - it allows
you to quickly get the information you need.
*Command: history.In DOS: No equivalent
History allows you to see what the past 10 commands (10 by default) that you
typed are. Each command is numbered although the system usually saves only
the last 10. You can turn off this saving of commands by using set history=0
(this is not available on BSD UNIX, but you can delete any incriminating
history files by deleting the .history file in your home directory). You can
also opt to keep more or less than 10 commands using the set history= command.
*Command: !..In DOS: F3 and F1 do a little of this
Typing !! will repeat the last command verbatim, like using F3 in DOS. You
can also type !23 and get command 23 (as it is shown in history) repeated.
Or you can even type !gre and the last command with the pattern 'gre' in it
(most likely a grep command) will be repeated.
With just those simple commands, you are able to perform most of the file
manipulation you will need.
2.3 The manic man command
-------------------------
Invaraibly, you will reach the point where you will want to know more
than is found in this file. Or, you will ask someone for help on
something, and they will say something to the order of:
Just see vi(5) and blah blah blah blah.
In UNIX, the entire manual is online for you to use. It's so absolutely
huge that you would never want the whole thing (indeed, when you see
printed copies they usually take up more kitchen counter space than June
Cleaver had in her house). When people refer to programs as progname(#)
they are actually dropping you an estoeric UNIX hint about getting more
information. The number in brackets is the section of the UNIX manual
(there are less than ten of these volumous beasts, I believe) which has
the information they are referring to. To get that information you can
usually just type
man progname
In some cases, you will want to search in another section than what
pops up - in this case just add the section number:
man vi 5
or something to that effect. When you are reading the man pages, you
will probably be in either the "more" or "less" viewer programs. You
can move around in these with the following keys:
Key: Action:
---- -------
(space) Next page
(enter) Next line
g Beginning of file
G End of file
n Next Page
b Previous Page
/sometxt Search for the next occurrence of "sometxt" (hit Enter to start
the search).
With a little luck and some intuition, you can wade through the man
pages and find what you are after. Keep in mind that they are complete
technical specifications for the commands, and are not necessarily
written to be easily understood. Rather, they just list all the options
and blurb about the item in question in as much technical jargon as
possible. Should you really need to pore over it, you might want to
pipe the manual into a file:
man more > more.man
This will create a file called "more.man" in the current directory,
which contains the manual pages for the command more(1).
2.3 Reaching Nirvanna through ed(1) - Text Manipulation
-----------------------------------
One of the chief commoddities that you'll be getting your grubbly little
hands on using UNIX is information. You need a method to keep all this
Stuff, hence text manipulation. I'll go over creating a file first, so you
can have your very own to look at. The easiest way to create a text file is
through ed(1). If you liked EDLIN, you'll love ed at your prompt, type:
ed [filename]
If [filename] is a new file you'll be told so, and then be left waiting.
typing 'a' allows you to start adding to the file (though no indication is
given that you have done so.) Type away and then when you're finished
enter a single period on a line by itself to end the input. Now you can type
one of the following commands:
w - write to disk
q - exit - if you haven't saved a ? is printed and you are given salvation
p - list current line
1,$p - list first to last line ($ = the last line)
More archaic commands are available; see man ed for more help.
If this form of torture isn't entirely your scene then there is a much
friendlier text editor available named vi (for Visual Editor), which you will
immediately hate. But given time you will really get to like it. Call vi by
typing vi [filename] and a nice screen will pop up with tilde marks down the
left side and 'filename [New File] mm/dd/yy' at the top. Now, I realise
that there must be SOME vi help SOMEWHERE, but I can't find it. So
here's a rough guideline to using it.
vi has three modes that you might be in. For lack of some wierd-ass
UNIX abbreviations for them, I've made my own names for them. You start
out in VISUAL editor mode, and can go to INSERT mode or COMMAND mode.
If you "vi newfile" or some unexisting file, you will see a bunch of
tildes down the left hand side of the screen and that is it. to
actually start typing (ie to move from VISUAL mode to INSERT mode), you
must choose the insert command, or "i". You can also choose "a" which
does the same thing, but moves you ONE CHARACTER right before adding
text. You can't move further left than where you started either (to,
for example, correct a mistake you just noticed earlier in the line).
However, once in INSERT mode you can just type normally. When you want
to move around, or do some editing, or something, you'll want to move
back to VISUAL mode. Do this by hitting [ESC]. Now, you can move
around with the movement keys:
j = one char left, k = one char right, k = one char up, l = one char down.
Or, you can delete a character in front of the current cursor position:
x = delete one character
dd = delete entire line (analagous to Ctrl-Y in wordstar)
You can also move up a page:
b = go back one page
n = go to next page
g = go to start of docuemnt
G = go to end of document
You can also repeat commands by typing a number first. So for example,
typing 10dd will delete the next 10 lines. typing 50j will move left
fifty characters.
Once you have everything edited and looking good, you'll want to save.
Go to COMMAND mode by hitting Q (must be upper case) from VISUAL mode
(and you will have to do [ESC]Q from INSERT mode).
You will see a prompt (a colon) pop up at the bottom of the screen and
the cursor will go there. At this point you are basically in ed(1)
again. You can use the "w" command to write the file, then the "q" to
quit... or you can quit without changing by doing a "quit!" (it forces
you to do this if you haven't saved). If you messed up and want to go
back to VISUAL mode from command mode, just enter the command "vi".
Many other commands are available but those are enough to get you by
on a day to day basis. With vi, practice definitely makes perfect.
There is also a quicker way to get to command mode, but it returns you
right back into visual mode when you have entered each command. From
visual mode, just type a colon ":" and the colon will appear, then type
the command and ENTER. Once it has executed you are back in visual
mode. This is faster in a lot of cases.
There is one more ESSENTIAL command for happy vi'ing. It's the undo
command, "u". You can use the "u" command from VISUAL mode any time
you like to undo the last editing action. Using it a second time will
re-do the last edit action.
2.4.Intra-system communication
----------------------------------
UNIX is designed as a multi-user operating system. Thus the chances of only
one person being logged on the system at the same time are quite slim; in
large mainframes there are often well over 20 people logged in at once, even
during off hours. UNIX allows you, using a number of built-in functions, to
communicate with and annoy these people freely. This is extremely useful for
getting information in a hurry. Coffee Talk thrives under UNIX.
*Command: who
The who command will tell you who is logged into the system. You are given
two fields of information about each user. Their login id is shown, and the
port that they are logged in from (called a tty - usually of the form ttyxx
where xx can be any combination of letters and numbers). Try this command
now. Usually there will be an operator logged in always, regardless of who
is on the system - this is just an account that stays open all the time and
should cause you no sudden paranoia.
The next thing we will want to do is commuinicate with these people. If
there's someone you know (or you can even do this to yourself, it will work
fine) then write them a note:
*Command: write
At your shell prompt, use 'write [userid]' to write another user. They will
hear a beep, and on their screen they will see:
MESSAGE FROM yourid ON TTYxx
Followed by each line of text you type, as soon as you finish typing it.
When you've finished your message, you can hit CTRL-D to finish - the person
you were writing to will see 'EOF' on their screen.
You can also pipe and redirect things into the input of a write function -
thus you can type a notice and:
write auser <notice.txt
I have a program called banner which just makes a large banner of the argument
(in big friendly letters). I often greet people with this command:
banner Good Morning! | write auser
If a user is logged on more than once, you will see a message:
User auser logged on more than once - writing to ttyxx
If for some reason they aren't responding you can try another tty - simply
add which tty you want to write to after the command (don't include the
'tty'). For example, to write to user jblow on ttyie:
write jblow ttyie
Sometimes write will tell you:
Cannot write to ttyxx - Permission denied.
This means that the person has turned off their messages and obviously
doesn't want to be disturbed by people writing them.
*Commmand: mesg
mesg controls whether your messages are on or off. The default is to have
them on so that people can write you; you can turn them off however by
issuing the command:
mesg n
Or turn them on using
mesg y
Typing 'mesg' with no aruments will tell you what the current setting is.
You can find out whether a person's messages are on or off, and a lot more
useful information by using the finger command.
*Command: finger
finger is one of the most useful UNIX commands you will encounter. Sometimes
versions of finger vary depending on your system; but on most new System V
and BSD UNIX systems the format is exactly the same. Finger is like an
extended who, which also allows you to get specific information on a user.
for example, you could type
finger jblow
and get the following:
[blah blah blah]
You are given the user's login id, message status (if messages are off you
are told so), time of login, idle time (time since user last entered a
command), when the mail was last read, the contents of the user's ~/.plan
and ~/.project files, and the user's full name.
The .project and .plan information is specified by creating files in your
home directory named .project and .plan respectively. Note that only the
first line of the .project file is shown. Some serious anal-retentive people
use this for its intended purpose, but most people put a friendly or silly
greeting in there (really dumb people provide you with their home address
and telephone number... heh heh heh).
Whoever set up your account most likely entered your full name in the "In
real life:" field - you can in fact change this to whatever you like using
chfn.
*Command: chfn
chfn (for CHange Full Name), allows you to change the contents of the "In real
life" field when someone fingers you. Just enter 'chfn' at the prompt and
you will be asked for a new full name - as your last name is given by your
id in most cases, lots of people stick their first name in here (It's not
kosher to call yourself Adolf Hitler on UNIX systems, by the way).
*Command: talk
When you tire of the akwardness of the write command, you might want to try
the talk command. This bascially allows you to chat to another user in a
nice split-screen chat mode; your typing goes on one half of the screen and
the person's that you're talking to goes on the other. Talk is much more
sophisticated too in that it gently pages the user without just barging in on
their screen. Attempt to talk to someone else by typing:
talk userid
And they will hear a beep and see this message:
You are being paged by jblow@machine.address.address
To respond type talk jblow@machine.address.address
Don't worry about the @ sign or the address information for now - I'll
explain that in the next section. You can actually reply to someone on your
own system just by typing the userid - (you don't need the @ sign or the
address).
While this is going on, the person who initiated the page is waiting in a
blank talk screen and getting a status report on how the paging is going.
When the person finally responds the top status line will say
[Connection Established]
and you can begin typing. To stop talking use Ctrl-C to exit.
If you are talking to someone on your machine and they are logged in
more than once you can pick the tty to talk to (just like with write).
but this time, you use just the two letters at the end:
talk jblow i5
will talk to jblow on ttyi5.
*Command: mail
Using the mail command, you can send electronic mail to any user of the
system, and you can read any mail that you have waiting in your own mailbox.
Most sytems will notify you if you have mail when you log in. To check your
mail box type:
mail
If there is no mail for you you will be told so, otherwise the list of
subject lines, or headers, will appear on the screen. Each message header
has a number and tells you who it's from, as well as the subject. You can
then hit <enter> to start reading at the first message.
Like ed, mail has the concept of a current message - you can use any of the
mail editing commands and they will effect the current message, or you can
specify which message you want them to work on. The commands are:
h ..- Redisplay the list of headers
d<#> ..- Delete message
r<#> ..- reply to message
s<#> <filename> - save message (it will save it to a file called mbox unless
you type a
filename using 's filename')
q ..- quit and append all undeleted messages to the ~/mbox file
x ..- exit, leaving the messages pending in your incoming mailbox.
the mbox file is a file in your home directory where any mail that you don't
delete is kept. You can go through and edit or delete this as you please;
it's a convenient place for storing mailings you want to keep for a while.
To mail another user, type:
mail userid
You will be prompted for a subject (which the other user will see in their
headers when they type mail). Then you are free to type whatever you want in
the mailing and end it with a CTRL-D character.
If you mess up their userid the mail will eventually get returned to you and
you can save it in mbox or somewhere else, edit it and then try again. In
chapter 4, I'll explain how to mail someone anywhere in the world, assuming
you know their address.
If you are lucky, there is a program called "elm" on your system. elm
is a much more advanced mailing system then the default mail(1), and
allows you to quote in your replies and use vi to write them etc. Find
out by just typing "elm" (it will be in the path if it's there) or if
you suspect it's around but not in the path then talk to the
administration on your system and bug them about it.
2.5 Multitasking without L.S.D.
-------------------------------
Multitasking on UNIX is extremely useful and very easy to do. Each 'thing'
you have running on the system is called a process or job. The shell which
you use to enter commands is a job which is always running; when it ends
you are logged out of the system.
*Command: jobs
To find out what jobs you have running, type the command:
jobs
from the shell. A list of all jobs currently running (each one with its own
number) is shown. Initially all you will see is your shell.
You get out of a job and back to the shell (where you can start new jobs) by
using the CTRL-Z hotkey. When you CTRL-Z a process its exectution is
suspended, and UNIX issues the message
Stopped
%
and you are returned to the command prompt. Try this - look up something in
the manual by typing:
man talk
and wait until the screen appears, then hit CTRL-Z. You will be returned to
the shell. Typing 'jobs' shows you that, sure enough, process number two is
man talk, and that the job is currently stopped. There will also be a '+'
symbox next to it, meaning simply that this is the CURRENT job. The csh job
will most likely have a '-' symbol next to it, indicating that it is the
PREVIOUS job.
You control which job you're seeing on the screen using the fg command.
*Command: fg
fg will put a specified job in the foreground. To put the job listed as
CURRENT (+) in jobs into the foreground, type fg %. The job resumes
execution from where you stopped it. To put a specific job in the foreground
by number, use fg %n where n is the number of the job.
You can also keep processes running in the background while you do ohter
things - this is achieved using the bg command.
*Command: bg
bg will place a specified job (use %n or %) into the background and continue
its execution. Note that if this job decides it's going to output to the
screen it will display right over whatever you are doing in the foreground.
You can avoid this by redirecting the output using > when you start the
process. This can be very chicken-and-egg if you don't know that you're going
to stick it in the background when you start though; most times it's not
really worth the hassle.
When a process finishes execution and exits while still in the background you
will be notified by UNIX that it has finished.
*Command: &
Using an ampersand '&' after a command line will automatically put that job
in the background. So, for example, you could type:
crack /etc/passwd >validfile &
and that process would begin running in the background, piping its output to
validfile and allowing you to go on and play with other things.
*Command: ps
ps, another wizard abbreviation for ProceS